Skip to content

fix: judge CC017 by the author passed to the author tools - #48

Merged
shenxianpeng merged 1 commit into
mainfrom
fix/ai-author-uses-passed-author
Nov 9, 2026
Merged

shenxianpeng merged 1 commit into
mainfrom
fix/ai-author-uses-passed-author

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

commit-check 2.20 added CC017: a commit whose author is an AI tool fails under ai_attribution = "forbid" or "disclose". For a message not yet committed, the rule reads the author git would record. Through this server, that was the server's own git identity, not the author the agent passed in:

  • validate_author_info never ran CC017.
  • validate_commit_context ran it on the server's identity and ignored author_name / author_email.

This change runs CC017 with the passed author (as GIT_AUTHOR_NAME / GIT_AUTHOR_EMAIL, inside the existing working-directory lock, restored afterwards). With the default policy (ignore), CC017 doesn't exist, so nothing changes. On commit-check older than 2.20 it is a no-op.

Before vs after

Server git identity Alice <alice@example.com>, config {"commit": {"ai_attribution": "forbid"}}:

Call Before After
validate_author_info(author_name="Claude", author_email="noreply@anthropic.com") pass: CC101 pass, CC102 pass (no CC017) fail: CC101 pass, CC102 pass, CC017 fail
validate_commit_context(message="feat: add caching", author_name="Claude", author_email="noreply@anthropic.com") pass: CC017 judged Alice <alice@example.com> fail: CC017 judged Claude <noreply@anthropic.com>

validate_commit_message and a validate_commit_context call without an author still judge the pending author, the same as the CLI.

Rest of the sync check against CLI v2.20.2 and main

Nothing else needed. commit-check>=2.18.0,<3 already resolves to 2.20.2 on Python 3.11+, and the message tools pick up CC013 to CC017 and the new detections on their own (MESSAGE_CHECKS comes from the CLI). The full suite passes against 2.19.5, 2.20.2 and CLI main (including the new output header, which the server doesn't print). --ai-attribution-only isn't exposed: nobody has asked for a PR-description tool.

Tests

127 passed, 100% line coverage. The new CC017 tests skip on commit-check older than 2.20 (the Python 3.10 CI job still gets 2.19.5).

commit-check 2.20 added CC017, which fails a commit whose author is an AI
tool. For a message not yet committed it reads the author git would
record, so through this server it judged the server's own git identity:
validate_author_info never ran it, and validate_commit_context ignored
the author_name/author_email it was given.

Run CC017 with the passed author as GIT_AUTHOR_NAME/GIT_AUTHOR_EMAIL,
inside the working-directory lock, and restore the environment after.
@github-actions github-actions Bot added the bug Something isn't working label Nov 9, 2026
@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@shenxianpeng shenxianpeng self-assigned this Nov 9, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (33b7d5e) to head (e148abc).

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #48   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines          279       286    +7     
=========================================
+ Hits           279       286    +7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shenxianpeng
shenxianpeng merged commit f8feca9 into main Nov 9, 2026
8 checks passed
@shenxianpeng
shenxianpeng deleted the fix/ai-author-uses-passed-author branch November 9, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants